1. Field of the Invention
The present invention relates generally to the dynamic allocation of resources in a computer system.
2. Description of the Related Art
Whenever a fixed set of system resources (e.g., shared data, input/output, storage space) is shared among a set of processes, a centralized resource dispatcher is usually charged with assigning and reclaiming these resources. Such scheduling is conventionally carried out according to a single policy, and this single policy is typically hard coded in the resource dispatcher. FIG. 1 shows an example of a system 100 including a single policy 102 for allocating and scheduling resources 104, 106 and 108 to applications and/or processes 110, 112 and 114 in a computer system, according to the related art. As shown therein, a single policy 102 grants resources to the applications 110, 112 and 114 as shown at 116, 118 and 120 according to some pre-established policy (such as round-robin, First In, First Out (FIFO)). Alternatively, the applications may synchronously or asynchronously request a needed resource from the policy 102 and dispatcher 102, as also suggested by arrows 116, 118 and 120. In any event, the single allocation/scheduling policy and dispatcher 102 may then selectively allocate resources 104, 106 and 108 to the applications 110, 112 and 114. That is, as shown in FIG. 1, the single allocation/scheduling policy and dispatcher 102 may bind resource 104 to application 1, bind resource 2 to application 3 and bind resource 3 to application 2 (for example).
Unfortunately, it is believed difficult or perhaps impossible to devise a single scheduling policy that is effective in optimally meeting the requirements of all present and future tasks in a software system that is reasonably versatile. For example, should a new application be added to the system 100 of FIG. 1, the single policy 102 may not efficiently allocate and dispatch resources thereto, as the system designer that originally designed the policy 102 more than likely had no prior knowledge of the resource requirements of the newly added application. The system designer is often forced to make tradeoffs, which provide, at best, only marginally acceptable service to those applications originally envisaged, as well as to those applications the system designer believes are reasonably likely to be run on the system 100.
There are two generally accepted schemes for improving the efficiency of resource allocation in a single policy environment. First, if the single policy is suitably parameterized and these parameters can be changed dynamically, it may be possible to influence the scheduling of resources at run time. The fact remains, however, that the same policy is applied to all processes and thus cannot satisfy their resource needs in an optimal manner. Second, the resources and processes or applications may be partitioned into classes (in a static or dynamic manner) such that all resources within a class are administered by the same policy. It then becomes possible to schedule resources within each class in an appropriate manner. However, because of this partitioning, processes and/or applications partitioned in one class may not access resources partitioned in other classes, and a new type of application or process will need to be made to fit within one of the existing classes, or another class may have to be created for the new process or application.
A problem common to both these schemes is that modifying parameters or partitioning processes/resources does not allow for on-the-fly creation of new resource-scheduling policies. Often, the system designer is faced with the difficult or impossible task of accurately predicting and implementing all of the possible resource allocation policies that current and future applications may require.
What are needed, therefore, are methods and systems for more efficiently allocating resources in a computer system.
It is, therefore, an object of the present invention to provide methods and systems for efficiently allocating resources in a computer system.
Accordingly, a computer system according to the present invention includes a resource, a process, a first policy module, a master policy and a dispatcher. The policy module is associated with the process and adapted at least to issue a resource allocation request to request an allocation of the resource to the process. The master policy is configured to query the first policy module according to a policy module query schedule, to receive the resource allocation request and to issue a corresponding resource allocation order. The dispatcher is configured to bind the required resource to the process according to the resource allocation order.
According to further embodiments, the process may be one of a plurality of processes and the first policy module may be one of a plurality of policy modules. At least one of the plurality of policy modules is associated with at least one of the plurality of processes and the master policy is adapted to selectably query the plurality of policy modules. The master policy may be adapted to query each of the plurality of policy modules according to a configurable statistical query distribution. Alternatively, the master policy may be adapted to query a selected one of the plurality of policy modules before querying any other one of the plurality of policy modules. The process may include an application. The resource may be one of a plurality of resources accessible to the computer system, such as, for example, a data structure, processing cycles, a storage device, shared memory, an I/O port, a process or another computer system. The system may further include a second policy module associated with the first policy module. The second policy module may be adapted to issue the resource allocation request when queried by the master policy when the first policy module does not issue the resource allocation request. The first policy module may include a selectably changeable policy module parameter. The value of the policy module parameter may influence the content of the resource allocation request. The policy module parameter may be selectably changeable by the process at run time, for example. The master policy module may include a selectably changeable master policy parameter that may be selectably changeable at run time. The value of the master policy parameter may influence the policy module query schedule of the master policy. The system may further include a third policy module, the third policy module being associated with the process and adapted to issue the resource allocation request when queried by the master policy. Some of the plurality of processes may be members of a class of processes, and at least one of the plurality of policy modules may be adapted to issue the resource allocation request on behalf of any member of the class of processes. Some of the plurality of resources may be members of a class of resources, and at least one of the plurality of policy modules may be adapted to issue a resource allocation request for any resource that is a member of the class of resources on behalf of a process or processes. The system may also include a policy data structure, the policy data structure including a reference to each of the plurality of policy modules that is associated with one or more of the plurality of processes. The master policy may be configured to query only those policy modules referenced in the policy data structure.
The system may further include one or more utility policy modules that are not associated with any of the plurality of processes and that may be configured to selectively carry out, when invoked by the master policy, a selective change of the master policy parameter and/or the execution of one or more predetermined jobs, for example. The policy data structure further may include references to these utility policy modules that are selectably invoked by the master policy. For example, a utility policy module may be configured to cause a re-generation of the policy data structure, at a selectable interval for example. The system may further include a second policy module and the first policy module may be adapted to identify the second policy module to the master policy as that policy module to query for the resource allocation request. The system may further include a resource data structure accessible to each of the plurality of policy modules. The resource data structure may include a reference to each one of the plurality of resources accessible to the computer system. One or more of the plurality of policy modules may be configured to access the resource data structure prior to (for example) issuing a resource allocation request.
The present invention is also a method of managing an allocation of a plurality of resources of a computer system adapted to support a plurality of processes, comprising the steps of selecting one of a plurality policy modules to query according to a master policy, each policy module of the plurality of policy modules being associated with and managing an allocation of resources required by at least one of the plurality of processes; issuing a query to the selected one of the plurality of policy modules; receiving a request for allocation of one of the plurality of resources in response to the issued query; issuing a resource allocation order to a dispatcher, the dispatcher being configured to bind selected resources to selected processes, the resource allocation order specifying the requested one of the plurality of resources, and executing the resource allocation order, the executing step being effective to bind the requested one of the plurality of resources to the at least one of the plurality of processes associated with the selected one of the plurality of policy modules.
For example, the master policy may be adapted to cause the selecting step to query each of the plurality of policy modules according to a configurable statistical query distribution. Alternatively, the master policy may be adapted to cause the selecting step to select one of the plurality of policy modules before selecting any other one of the plurality of policy modules, for example. When the plurality of policy modules includes a hierarchically lower policy module associated with the selected policy module, the selecting step may select the hierarchically lower policy module when the resource allocation request is not received from the selected policy module. One or more of the plurality of policy modules may be parameterized to include a policy module parameter, a value of which may influence the content of the resource allocation request. The method further may include a step of selectively changing the policy module parameter. Such a selective changing step may be carried out at run time, by the process or processes associated with the parameterized policy module, for example. The master policy module may include a selectably changeable master policy parameter. The value of the master policy parameter may influence which of the plurality of policy modules is selected by the selecting step. The method may further include a step of setting a value of the master policy parameter at run time. Some of the plurality of processes may be members of a class of processes, and at least one of the plurality of policy modules may carry out a step of issuing a resource allocation request on behalf of any member of the class of processes. Some of the plurality of resources may be members of a class of resources. One or more of the plurality of policy modules may carry out a step of issuing a resource allocation request for any resource that is a member of the class of resources. The computer system further may include a policy data structure, the policy data structure including a reference to each of the plurality of policy modules that is associated with at least one of the plurality of processes and the master policy may cause the selecting step to select only from those policy modules referenced in the policy data structure.
The computer system may include one or more utility policy modules that are not associated with any of the plurality of processes. A utility policy module, when invoked by the master policy, may cause at least one predetermined step to be carried out, such as a master policy parameter setting step to set the master policy parameter and/or an executing step to execute a predetermined job, for example. The policy data structure further may include references to these utility policy modules. The predetermined job may include a step of re-generating the policy data structure at a selectable interval, for example. The computer system further may include a resource data structure accessible to each of the plurality of policy modules. The resource data structure may include a reference to each one of the plurality of resources accessible to the computer system. At least one of the plurality of policy modules may carry out a step of accessing the resource data structure prior to (for example) issuing a resource allocation request.